﻿@page "{albumName}/{photoName}/{handler?}"
@model PhotoModel
@{
    ViewData["Title"] = $"{Model.Photo.DisplayName} - {Model.Photo.Album.Name}";
    ViewData["Description"] = $"{Model.Photo.DisplayName} 来自于相册 {Model.Photo.Album.Name}";
    ViewData["Image"] = Request.Scheme + "://" + Request.Host + Model.Photo.GetThumbnailLink((int)ImageType.Full, out int h);
}

<div id="admin" if-authorized>
    <form method="post">
        <input type="text" name="name" aria-label="Name" required value="@Model.Photo.DisplayName" />
        <input type="submit" asp-page-handler="rename" data-progress="修改中..." value="重命名照片" />
    </form>

    <form method="post" class="delete">
        <input type="submit" id="deletephoto" asp-page-handler="delete" aria-label="删除照片..." title="删除照片..." value="X" />
    </form>
</div>

<div id="title">
    <paging model="@Model.Photo" />
    <h2>@Model.Photo.DisplayName</h2>
</div>

<div class="photo">
    <img photo="@Model.Photo" type="Full" />

    <aside>
        <span>
            Posted in:
            <a href="@Model.Photo.Album.Link">@Model.Photo.Album.Name</a>
        </span>
        <a href="@Model.Photo.DownloadLink" class="download">下载</a>
    </aside>
</div>


@section scripts{
    <script if-authorized src="/js/admin.js" async></script>
}

@section head {
    <link if-authorized rel="stylesheet" href="/css/admin.scss" />
    <link rel="index" href="@Model.Photo.Album.Link" />
    @if (Model.Photo.Next != null)
    {
        <link rel="next" href="@Model.Photo.Next.Link" />
        <link rel="prefetch" href="@Model.Photo.Next.Link" />
    }

    @if (Model.Photo.Previous != null)
    {
        <link rel="prev" href="@Model.Photo.Previous.Link" />
    }
}